home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / NetSourceProxy.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  32.4 KB  |  878 lines

  1. ∩╗┐<%@ Language=VBScript CODEPAGE=65001 %>
  2. <!--#include file="include/wmsLocStrings.inc"-->
  3. <!--#include file="include/wmsServerHash.inc"-->
  4. <!--#include file="include/wmsPlugins.inc"-->
  5. <!--#include file="include/wmsHeader.inc"-->
  6. <!--#include file="include/wmsPageBanner.inc"-->
  7. <!--#include file="include/wmsError.inc"-->
  8. <%
  9. '+-------------------------------------------------------------------------
  10. '
  11. '  Microsoft Windows Media
  12. '  Copyright (C) Microsoft Corporation. All rights reserved.
  13. '
  14. ' File:    NetSourceProxy.asp
  15. '
  16. ' Contents:
  17. '
  18. '--------------------------------------------------------------------------
  19.  
  20. ConnectToPlugin
  21. ConnectToPluginAdmin
  22.  
  23. on error resume next
  24.  
  25. Dim strProtocolName
  26. Dim strProxyHostName
  27. Dim dwProxyPort
  28. Dim dwProxySettings
  29. Dim strUserName
  30. Dim bPasswordExists
  31. Dim strPassword
  32. Dim strConfirmPassword
  33. Dim bError
  34.  
  35. Dim bUseProxyServer
  36. Dim bServerRequiresAuthentication
  37.  
  38. Const WMS_PROXY_SETTING_NONE   = 0
  39. Const WMS_PROXY_SETTING_MANUAL  = 1
  40. Const WMS_PROXY_SETTING_AUTO   = 2
  41. Const WMS_PROXY_SETTING_BROWSER  = 3    ' Only valid for HTTP 
  42.  
  43. dwProxyPort = 0
  44. strProtocolName = RemoveDangerousCharacters( Left( SafeUnescape( GetPostOrQsVal("protocol") ), 15 ) )
  45. bUseProxyServer = FALSE
  46. bServerRequiresAuthentication = FALSE
  47.  
  48. bError = FALSE
  49. bPasswordExists = FALSE
  50.  
  51. strOp = GetFormStr( "submit" )
  52. if ( 0 < Len( strOp ) ) then
  53.  
  54.   on error resume next
  55.   
  56.   ' use a do-while-false structure to break out upon first error  
  57.   do
  58.     bUseProxyServer = CBool( 0 < Len( GetFormStr( "useProxy" ) ) )
  59.     bProxyRequiresAuthen = CBool( 0 < Len( GetFormStr( "ProxyRequiresAuthen" ) ) )
  60.     
  61.     strProxyHostName = RemoveDangerousCharacters( Left( SafeUnescape( GetFormStr("proxyName" ) ), MAX_LEN_SERVERNAME ) )
  62.     dwProxyPort = CDbl( Left( GetFormDbl("port"), 5 ) )
  63.     
  64.     err.Clear
  65.     
  66.     if( ( 0 <= dwProxyPort ) and ( 65536 > dwProxyPort ) and ( dwProxyPort <> g_objPluginAdmin.ProxyPort( strProtocolName ) ) ) then
  67.         g_objPluginAdmin.SetProxyPort strProtocolName, dwProxyPort
  68.     end if
  69.     if( ErrorDetected( "UseProxy" ) ) then
  70.       err.description = RemoveDangerousCharacters( L_MANUALPROXYFAILED_TEXT )
  71.       bError = TRUE
  72.       Exit Do
  73.     end if
  74.  
  75.     if( 0 <> StrComp( strProxyHostName, g_objPluginAdmin.ProxyHostName( strProtocolName ), vbTextCompare ) ) then
  76.       g_objPluginAdmin.SetProxyHostName strProtocolName, strProxyHostName
  77.     end if
  78.     if( ErrorDetected( "UseProxy" ) ) then
  79.       err.description = RemoveDangerousCharacters( L_MANUALPROXYFAILED_TEXT )
  80.       bError = TRUE
  81.       Exit Do
  82.     end if
  83.  
  84.     if bUseProxyServer then
  85.  
  86.       g_objPluginAdmin.SetProxySettings strProtocolName, WMS_PROXY_SETTING_MANUAL
  87.       if( ErrorDetected( "UseProxy" ) ) then
  88.         err.description = RemoveDangerousCharacters( L_MANUALPROXYFAILED_TEXT )
  89.         bError = TRUE
  90.         Exit Do
  91.       end if
  92.  
  93.     else
  94.  
  95.       g_objPluginAdmin.SetProxySettings strProtocolName, WMS_PROXY_SETTING_NONE
  96.       if( ErrorDetected( "UseProxy" ) ) then
  97.         err.description = RemoveDangerousCharacters( L_MANUALPROXYFAILED_TEXT )
  98.         bError = TRUE
  99.         Exit Do
  100.       end if
  101.  
  102.     end if
  103.  
  104.     strUserName = Left( RemoveSpecifiedChars( SafeUnescape( trim( posting( "userName" ) ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME )
  105.     strPassword = Left( RemoveDangerousCharacters( SafeUnescape( trim( posting( "password" ) ) ) ), MAX_PASSWD )
  106.     strConfirmPassword = Left( RemoveDangerousCharacters( SafeUnescape( trim( posting( "confirm" ) ) ) ), MAX_PASSWD )
  107.  
  108.     if ( 0 < Len( strUserName ) ) then
  109.  
  110.         if ( 0 <> StrComp( strPassword, L_PASSWORDPHOLD_TEXT, vbTextConfirm ) ) then
  111.             if( bProxyRequiresAuthen ) then
  112.                 if( 0 = strcomp( strPassword, strConfirmPassword ) ) then
  113.                     if( DetectSpecifiedChars( posting( "userName" ), REGEXP_DANGEROUS_CHARS ) ) then
  114.                         Err.Raise( -2 )
  115.                         Err.Description = L_USERNAMEBADCHAR_TEXT
  116.                         bError = TRUE
  117.                         Exit Do
  118.                     elseif( DetectSpecifiedChars( posting( "password" ), REGEXP_DANGEROUS_CHARS ) ) then
  119.                         Err.Raise( -2 )
  120.                         Err.Description = L_PASSWORDBADCHAR_TEXT
  121.                         bError = TRUE
  122.                         Exit Do
  123.                     else
  124.                         s_WMSAdmin.SetNetSourceProxyCredentials g_objPluginAdmin, strProtocolName, strUserName, strPassword
  125.                         if( ErrorDetected( "Credentials" ) ) then
  126.                             bError = TRUE
  127.                             Exit Do
  128.                         end if
  129.                     end if
  130.                 else
  131.                     Err.Raise( -1 )
  132.                     err.description = RemoveDangerousCharacters( L_PASSWORDMISMATCH_TEXT )
  133.                     bError = TRUE
  134.                     Exit Do
  135.                 end if
  136.             else
  137.                 s_WMSAdmin.SetNetSourceProxyCredentials g_objPluginAdmin, strProtocolName, CStr( "" ), CStr( "" )
  138.                 if( ErrorDetected( "Credentials" ) ) then
  139.                     bError = TRUE
  140.                     Exit Do
  141.                 end if
  142.             end if
  143.         end if
  144.  
  145.     else
  146.         s_WMSAdmin.SetNetSourceProxyCredentials g_objPluginAdmin, strProtocolName, CStr( "" ), CStr( "" )
  147.         if( ErrorDetected( "Credentials" ) ) then
  148.             bError = TRUE
  149.         end if
  150.     end if
  151.  
  152.     if ( FALSE = bError ) and ( 0 = err.Number ) then
  153.         Response.Redirect "NetworkSource.asp?server=" & g_strQueryStringServer & _
  154.                           "&protocolList=" & GetPostOrQsVal( "protocolList" ) & _
  155.                           "&usePortRange=" & GetPostOrQsVal( "usePortRange" ) & _
  156.                           "&portRange=" & GetPostOrQsVal( "portRange" ) & _
  157.                           "&useUDP=" & GetPostOrQsVal( "useUDP" ) & _
  158.                           "&useTCP=" & GetPostOrQsVal( "useTCP" ) & _
  159.                           "&category=" & g_strCategory & _
  160.                           "&pluginIndex=" & qs("pluginIndex") & _
  161.                           "&protocol=" & SafeEscape( SafeUnescape( GetPostOrQsVal("protocol") ) )
  162.     end if
  163.   
  164.   Loop Until TRUE
  165.   
  166. else
  167.   on error resume next
  168.   dwProxySettings = g_objPluginAdmin.ProxySettings( strProtocolName )
  169.   if( 0 <> err.Number ) then
  170.     dwProxySettings = WMS_PROXY_SETTING_BROWSER
  171.     err.Clear
  172.   end if
  173.     
  174.   bUseProxyServer = WMS_PROXY_SETTING_NONE <> dwProxySettings
  175.  
  176.   strProxyHostName = g_objPluginAdmin.ProxyHostName( strProtocolName )
  177.   if( 0 <> err.Number ) then
  178.     strProxyHostName = ""
  179.     err.Clear
  180.   end if
  181.   
  182.   dwProxyPort = CDbl( g_objPluginAdmin.ProxyPort( strProtocolName ) )
  183.   if( 0 <> err.Number ) then
  184.     dwProxyPort = ""
  185.     err.Clear
  186.   end if
  187.   
  188.   strUserName = g_objPluginAdmin.ProxyUserName( strProtocolName )
  189.   if( 0 <> err.Number ) then
  190.     strUserName = ""
  191.     err.Clear
  192.   end if
  193.   
  194.   bServerRequiresAuthentication = CBool( 0 < Len( strUserName ) )
  195.  
  196.   bPasswordExists = g_objPluginAdmin.ProxyPassword( strProtocolName )
  197.   if( 0 <> err.Number ) then
  198.     strPassword = ""
  199.     err.Clear
  200.   end if
  201.   if( bPasswordExists ) then
  202.     strPassword = L_PASSWORDPHOLD_TEXT
  203.   else
  204.     strPassword = ""
  205.   end if
  206.  
  207. end if
  208.  
  209. '////////////////////////////////////////////////////////////////
  210. Function BuildProtocolText( strValue )
  211.     Dim strTemplate
  212.     strTemplate = L_CONFIGURE_TEXT
  213.     BuildProtocolText = Replace( strTemplate, "___", Server.HTMLEncode( trim( strValue ) ), 1 )
  214. End Function
  215.  
  216. WriteHTMLHeader( g_strDecodedServerName ) 
  217. %>
  218. <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
  219. <% WritePluginJSUtils %>
  220. <script language=javascript>
  221. <!--
  222. /*@cc_on @*/
  223.  
  224. ///////////////////////////
  225. function RemoveBadUsernameChars( szUnfiltered )
  226. {
  227.     <% jsTRY %>
  228.         var szSafeString = new String( szUnfiltered );
  229.         var re = /\<|\>|\"|`|!|@|#|\$|\%|\^|\||\[|\]|\;|\:|\?|\(|\)|\{|\}|\&|\u201C|\u201D|\u201E|\"\&/gim;
  230.         szSafeString = szUnfiltered.replace( re, "" );
  231.  
  232.         return( szSafeString );
  233.     <% jsCATCH %>
  234. }
  235.  
  236. var g_bUserAlertedToBadUerName = false;
  237. var g_bUserAlertedToBadPasswd = false;
  238. var g_IsValidationMutexBusy = false;
  239.  
  240. ///////////////////////////
  241. function CheckIfUserChanged()
  242. {
  243.     <% jsTRY %>
  244.         var szUser;
  245.         var szPass;
  246.         var szConfirm;
  247.  
  248.         if( document.forms.pluginForm.username.value == "<%= EscBackslashChar( Left( RemoveSpecifiedChars( SafeUnescape( trim( strUserName ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME ) ) %>" )
  249.         {
  250.             return( false );
  251.         }
  252.  
  253.         if( document.forms.pluginForm.password.value == "<%= Server.HTMLEncode( L_PASSWORDPHOLD_TEXT ) %>" )
  254.         {
  255.             document.forms.pluginForm.password.value = "";
  256.             document.forms.pluginForm.confirm.value = "";
  257.             return( true );
  258.         }
  259.  
  260.         if( document.forms.pluginForm.confirm.value == "<%= Server.HTMLEncode( L_PASSWORDPHOLD_TEXT ) %>" )
  261.         {
  262.             document.forms.pluginForm.password.value = "";
  263.             document.forms.pluginForm.confirm.value = "";
  264.             return( true );
  265.         }
  266.  
  267.         szUser = new String( document.forms.pluginForm.username.value );
  268.         if( 0 == szUser.length )
  269.         {
  270.             return( true );
  271.         }
  272.     <% jsCATCH %>
  273.     return( true );
  274. }
  275.  
  276. ///////////////////////////
  277. function ValidateUserPass()
  278. {
  279.     <% jsTRY %>
  280.         var szUser = "";
  281.         var szPass = "";
  282.         var szConf = "";
  283.         var bUserOkay = true;
  284.         var bError = false;
  285.         var bUserChanged = false;
  286.  
  287.         if( true == g_IsValidationMutexBusy )
  288.         {
  289.             return( true );
  290.         }
  291.         g_IsValidationMutexBusy = true;
  292.         
  293.         document.forms.pluginForm.ok.disabled = false;
  294.         
  295.         bUserChanged = CheckIfUserChanged();
  296.         
  297.         szUser = new String( document.forms.pluginForm.username.value )
  298.         szPass = new String( document.forms.pluginForm.password.value )
  299.         szConf = new String( document.forms.pluginForm.confirm.value )
  300.  
  301.         if( ( 0 == szUser.length ) && ( 0 == szPass.length ) && ( 0 == szConf.length ) )
  302.         {
  303.             // it's legal to clear all credentials
  304.             if( false == bError )
  305.             {
  306.                 document.forms.pluginForm.ok.disabled = false;
  307.                 window.status = "";
  308.             }
  309.             g_IsValidationMutexBusy = false;
  310.             return( true );
  311.         }
  312.         
  313.         if( ( 0 == szUser.length ) || bUserChanged )
  314.         {
  315.             document.forms.pluginForm.ok.disabled = ( 0 == szUser.length ) && ( ( 0 < szPass.length ) || ( 0 < szConf.length ) );
  316.         }
  317.         
  318.         // check username
  319.         var szFilteredUser = RemoveBadUsernameChars( szUser );
  320.         if( szUser.length != szFilteredUser.length )
  321.         {
  322.             document.forms.pluginForm.username.style.color = "#FF0000";
  323.             document.forms.pluginForm.ok.disabled = true;
  324.             bError = true;
  325.             window.status = "<%= L_USERNAMEBADCHAR_TEXT %>";
  326.             if( false == g_bUserAlertedToBadUerName )
  327.             {
  328.                 g_bUserAlertedToBadUerName = true;
  329.                 window.alert( "<%= L_INVALIDCHARSINUSERNAME_TEXT %>" );
  330.             }
  331.         }
  332.         else
  333.         {
  334.             document.forms.pluginForm.username.style.color = "#000000";
  335.         }
  336.         
  337.         // if any changes to pass or confirm, wipe canned password fields
  338.         if( ( ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.password.value ) &&
  339.               ( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.confirm.value ) ) ||
  340.             ( ( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.password.value ) && 
  341.               ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.confirm.value ) ) )
  342.         {
  343.             document.forms.pluginForm.password.value = document.forms.pluginForm.confirm.value = "";
  344.             g_IsValidationMutexBusy = false;
  345.             return( true );
  346.         }
  347.  
  348.         // if any changes to username, wipe canned password fields
  349.         if( ( ( 0 < szConf.length ) || ( 0 < szPass.length ) ) && ( szPass.length != szConf.length ) )
  350.         {
  351.             if( ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.password.value ) || 
  352.                 ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.confirm.value ) )
  353.             {
  354.                 szPass = "";
  355.                 szConf = "";
  356.                 document.forms.pluginForm.password.value = document.forms.pluginForm.confirm.value = "";
  357.                 g_IsValidationMutexBusy = false;
  358.                 return( true );
  359.             }
  360.         }
  361.  
  362.         if( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.password.value )
  363.         {
  364.             var szFilteredPass = RemoveDangerousCharacters( szPass );
  365.             if( szPass.length != szFilteredPass.length )
  366.             {
  367.                 document.forms.pluginForm.password.style.color = "#FF0000";
  368.                 document.forms.pluginForm.ok.disabled = true;
  369.                 szPass = "";
  370.                 bError = true;
  371.                 window.status = "<%= L_PASSWORDBADCHAR_TEXT %>";
  372.                 if( false == g_bUserAlertedToBadPasswd )
  373.                 {
  374.                     g_bUserAlertedToBadPasswd = true;
  375.                     window.alert( "<%= L_PASSWORDBADCHAR_TEXT %>" );
  376.                 }
  377.             }
  378.             else
  379.             {
  380.                 document.forms.pluginForm.password.style.color = "#000000";
  381.             }
  382.         }
  383.  
  384.         if( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.confirm.value )
  385.         {
  386.             var szFilteredConf = RemoveDangerousCharacters( szConf );
  387.             if( szConf.length != szFilteredConf.length )
  388.             {
  389.                 document.forms.pluginForm.confirm.style.color = "#FF0000";
  390.                 document.forms.pluginForm.ok.disabled = true;
  391.                 szConf = "";
  392.                 bError = true;
  393.                 window.status = "<%= L_PASSWORDBADCHAR_TEXT %>";
  394.                 if( false == g_bUserAlertedToBadPasswd )
  395.                 {
  396.                     g_bUserAlertedToBadPasswd = true;
  397.                     window.alert( "<%= L_PASSWORDBADCHAR_TEXT %>" );
  398.                 }
  399.             }
  400.             else
  401.             {
  402.                 document.forms.pluginForm.confirm.style.color = "#000000";
  403.             }
  404.         }
  405.         
  406.         if( true == bError )
  407.         {
  408.             document.forms.pluginForm.ok.disabled = true;
  409.         }
  410.         else
  411.         {
  412.             window.status = "";
  413.             if( ( 0 == szUser.length ) && ( 0 == szPass.length ) && ( 0 == szConf.length ) )
  414.             {
  415.                 document.forms.pluginForm.ok.disabled = false;
  416.                 g_IsValidationMutexBusy = false;
  417.                 return( true );
  418.             }
  419.                 
  420.             if( ( false == bError ) && document.forms.pluginForm.password.value == document.forms.pluginForm.confirm.value )
  421.             {
  422.                 if( 0 < szUser.length )
  423.                 {
  424.                     document.forms.pluginForm.ok.disabled = false;
  425.                 }
  426.                 g_IsValidationMutexBusy = false;
  427.                 return( true );
  428.             }
  429.         }
  430.                 
  431.         document.forms.pluginForm.ok.disabled = true;
  432.         g_IsValidationMutexBusy = false;
  433.         return( true );
  434.     <% jsCATCH %>
  435. }
  436.  
  437. ///////////////////////////////////////////////////////////////////////////
  438. function IsLegalProxyName( szName )
  439. {
  440.     <% jsTRY %>
  441.     // disregard white spaces
  442.     var szNameFiltered = szName.replace( /(\s)+/g, "" );
  443.     if( szNameFiltered.length != szName.length )
  444.     {
  445.         window.status = "<%= Server.HTMLEncode( L_INVALIDSERVERNAME_TEXT ) %>";
  446.         return( false );
  447.     }
  448.     
  449.     szNameFiltered = RemoveDangerousCharacters( szName );
  450.     if( szNameFiltered.length != szName.length )
  451.     {
  452.         window.status = "<%= Server.HTMLEncode( L_INVALIDSERVERNAME_TEXT ) %>";
  453.         return( false );
  454.     }
  455.     else
  456.     {
  457.         window.status = "";
  458.         return( true );
  459.     }
  460.     <% jsCATCH %>
  461.     return( false );
  462. }
  463.  
  464. ///////////////////////////////////////////////////////////////////////////
  465. function IsNaturalNumber( szValue )
  466. {
  467.     <% jsTRY %>
  468.     var dwNumber;
  469.     var szNumber = szValue;
  470.     var szConvertedNumber;
  471.     
  472.     var regExpTest = new RegExp( /^\d+$/gi );
  473.     if( ! regExpTest.test( szValue ) )
  474.     {
  475.         return( false );
  476.     }
  477.     return( true );
  478.     
  479.     <% jsCATCH %>
  480.     return( false );
  481. }
  482.  
  483. ////////////////////////////////////////////////////////////
  484. function IsValidPortNumber( szValue )
  485. {
  486.     <% jsTRY %>
  487.         var dwNumber = new Number( szValue );
  488.     
  489.         if( dwNumber > 65535 )
  490.         {
  491.             return( false );
  492.         }
  493.         
  494.         if( dwNumber <= 0 )
  495.         {
  496.             return( false );
  497.         }
  498.     <% jsCATCH %>
  499.     return( true );
  500. }
  501.  
  502. ////////////////////////////////////////////////////////////
  503. function EnableDisableTextAndButtons()
  504. {
  505.     <% jsTRY %>
  506.         var bAllowProxyServerControls = false;
  507.         var bAllowAuthenControls = false;
  508.         var bAllowOK = true;
  509.  
  510.         document.forms.pluginForm.ProxyRequiresAuthen.disabled = false; //! document.forms.pluginForm.useProxy.checked;
  511.         document.forms.pluginForm.proxyName.disabled = false; //! document.forms.pluginForm.useProxy.checked;
  512.         document.forms.pluginForm.port.disabled = false; //! document.forms.pluginForm.useProxy.checked;
  513.  
  514.         // User a proxy server
  515.         bAllowProxyServerControls = document.forms.pluginForm.useProxy.checked;
  516. /*
  517.         document.all.AddressLabel.disabled = ! document.forms.pluginForm.useProxy.checked;
  518.         document.forms.pluginForm.proxyName.disabled = ! bAllowProxyServerControls;
  519.         document.all.PortLabel.disabled = ! document.forms.pluginForm.useProxy.checked;
  520.         document.forms.pluginForm.port.disabled = ! bAllowProxyServerControls;
  521. */
  522.  
  523.         // Proxy requires authentication
  524.         bAllowAuthenControls = ( ( ! document.forms.pluginForm.ProxyRequiresAuthen.disabled ) && ( document.forms.pluginForm.ProxyRequiresAuthen.checked ) );
  525.         <% if brMSIE = g_dwBrowserType then %>
  526.         document.all.UsernameLabel.disabled = ! bAllowAuthenControls;
  527.         document.all.PasswordLabel.disabled = ! bAllowAuthenControls;
  528.         document.all.ConfirmLabel.disabled = ! bAllowAuthenControls;
  529.         <% end if %>
  530.         document.forms.pluginForm.username.disabled = ! bAllowAuthenControls;
  531.         document.forms.pluginForm.password.disabled = ! bAllowAuthenControls;
  532.         document.forms.pluginForm.confirm.disabled = ! bAllowAuthenControls;
  533.  
  534.         if( ( ! IsNaturalNumber( document.forms.pluginForm.port.value ) ) ||
  535.           ( ! IsValidPortNumber( document.forms.pluginForm.port.value ) ) )
  536.         {
  537.             document.forms.pluginForm.port.style.color="#ff0000";
  538.             document.forms.pluginForm.ok.disabled = true;
  539.             return;
  540.         }
  541.     
  542.         var szProxyName = new String( document.forms.pluginForm.proxyName.value );
  543.         if( ( 0 == szProxyName.length ) || ( false == IsLegalProxyName( szProxyName ) ) )
  544.         {
  545. //            if( bAllowProxyServerControls )
  546. //            {
  547.                 document.forms.pluginForm.ok.disabled = true;
  548.                 document.forms.pluginForm.proxyName.style.color="#ff0000";
  549.                 return;
  550. //            }
  551.         }
  552.  
  553.         var szValPort = new String( document.forms.pluginForm.port.value );
  554.         if( 0 == szValPort.length )
  555.         {
  556.             if( bAllowProxyServerControls )
  557.             {
  558.                 document.forms.pluginForm.ok.disabled = true;
  559.                 document.forms.pluginForm.port.style.color="#ff0000";
  560.                 return;
  561.             }
  562.         }
  563.         else
  564.         {
  565.             if( ( ! IsNaturalNumber( szValPort ) ) ||
  566.             ( ! IsValidPortNumber( szValPort ) ) )
  567.             {
  568.                 document.forms.pluginForm.ok.disabled = true;
  569.                 document.forms.pluginForm.port.style.color="#ff0000";
  570.                 return;
  571.             }
  572.         }
  573.         if( bAllowProxyServerControls )
  574.         {
  575.             window.status = "";
  576.             document.forms.pluginForm.proxyName.style.color="#000000";
  577.             document.forms.pluginForm.port.style.color="#000000";
  578.         }
  579.         else
  580.         {
  581.             document.forms.pluginForm.proxyName.style.color="#666666";
  582.             document.forms.pluginForm.port.style.color="#666666";
  583.         }
  584.         
  585.         document.forms.pluginForm.ok.disabled = ! bAllowOK;
  586.     <% jsCATCH %>
  587. }
  588.  
  589. ////////////////////////////////////////////////////////////
  590. function GoBack()
  591. {
  592.     <% jsTRY %>
  593.         var szUsePortRange,szPortRange, szUDP, szTCP;
  594.  
  595.         szUsePortRange = new String( "<%= qs( "UsePortRange" ) %>" );
  596.         szPortRange =  new String( "<%= qs( "PortRange" ) %>" );
  597.         szUDP = new String( "<%= qs( "useUDP" ) %>" );
  598.         szTCP = new String( "<%= qs( "useTCP" ) %>" );
  599.         document.location.replace( "NetworkSource.asp?server=<%= g_strQueryStringServer %>&category=<%= GetPostOrQsVal("category") %>&pluginIndex=<%= qs( "pluginIndex" ) %>&protocolList=<%= GetPostOrQsVal("protocolList") %>" + "&usePortRange=" + szUsePortRange + "&portRange=" + szPortRange + "&useUDP=" + szUDP + "&useTCP=" + szTCP );
  600.     <% jsCATCH %>
  601. }
  602. -->
  603. </script>
  604. </head>
  605. <body class="pluginBody" onLoad="JavaScript:EnableDisableTextAndButtons();" oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
  606. <table width="100%" class="pluginheader" height="90" cellspacing="0" cellpadding="0" border="0">
  607.     <tr>
  608.         <td colspan="2" class="pluginheadertext" nowrap>
  609.             <%= Server.HTMLEncode( g_strServerName ) %><% if ( 0 <> Len( g_strEncodedPubPointName ) ) then Response.Write( " (" & Server.HTMLEncode( ConvertPPName( g_strPubPointName, -1 ) ) ) & ")" end if %>
  610.         </td>
  611.     </tr>
  612.     <tr>
  613.         <td class="pluginheadertext" nowrap>
  614.             <%= Server.HTMLEncode( g_strPluginName ) %>
  615.         </td>
  616.         <td>
  617. <% if( FALSE = g_bSecureConnection ) then
  618. %>                <script language="JavaScript">
  619.                     ShowHideSecureWarning( "img/Not_secure_32.gif" );
  620.                 </script>
  621. <% end if
  622.  
  623. if "" <> strProtocolName then
  624.   %>        </td>
  625.         </tr>
  626.         <tr>
  627.             <td colspan="2" class="pluginheadertext" nowrap>
  628.                 <%= BuildProtocolText( ucase( strProtocolName ) ) %><%
  629. end if
  630. %>
  631.         </td>
  632.     </tr>
  633. </table>
  634. <% on error resume next %>
  635. <table width="<%= Server.HTMLEncode( STDTABLEWIDTH ) %>">
  636. <tr>
  637.   <td valign=top>
  638.  
  639.     <% WriteStdPluginForm %>
  640.     <input type="hidden" name="protocolList" value="<%= GetPostOrQsVal( "protocolList" ) %>">
  641.     <input type="hidden" name="usePortRange" value="<%= GetPostOrQsVal( "usePortRange" ) %>">   
  642.     <input type="hidden" name="portRange" value="<%= GetPostOrQsVal( "portRange" ) %>">
  643.     <input type="hidden" name="useUDP" value="<%= GetPostOrQsVal( "useUDP" ) %>">
  644.     <input type="hidden" name="useTCP" value="<%= GetPostOrQsVal( "useTCP" ) %>">
  645.  
  646.     <p> 
  647.     <div class="normal">
  648.     </div>
  649.     
  650.     <table cellpadding=0 cellspacing=0 border=0 class="propgroupbox" width="100%">
  651.     <tr>
  652.       <td>
  653.         <div class="defaultcursor" >
  654.           <input 
  655.             type="checkbox" 
  656.             name="useProxy" 
  657.             ID="useProxyID"
  658.             value="on" 
  659.             tabindex=1 <% 
  660.           if ( ( 0 < Len( strProxyHostName ) ) and ( WMS_PROXY_SETTING_NONE <> dwProxySettings ) ) then %> checked <% end if %>
  661.             onClick="JavaScript:EnableDisableTextAndButtons();" 
  662.             onChange="JavaScript:EnableDisableTextAndButtons();"
  663.           > <label for="useProxyID" ID="useProxyLabel" class="defaultcursor" >
  664.           <% RenderWithErrorCheck Server.HTMLEncode( L_USEPROXY_TEXT ), "UseProxy" %></label><br> 
  665.         </div>
  666.       </td>
  667.     </tr>
  668.     <tr>
  669.       <td colspan=2>
  670.         <table color="#000000" width="100%" border=0 cellpadding=0>
  671.           <tr>
  672.             <td width=60> </td>
  673.             <td class="defaultcursor" align=left nowrap>
  674.               <span nowrap name="AddressLabel" ID="AddressLabel"><%= Server.HTMLEncode( L_ADDRESSCOLON_TEXT ) %> </span>
  675.             </td>
  676.             <td align=left>
  677.               <input 
  678.                 type="text" 
  679.                 name="proxyName" 
  680.                 value="<%= RemoveSpecifiedChars( strProxyHostName , REGEXP_DANGEROUS_CHARS ) %>" 
  681.                 size=15 
  682.                 maxlength=255 
  683.                 tabindex=2
  684.                 onKeyUp="JavaScript:EnableDisableTextAndButtons();"
  685.                 onKeyDown="JavaScript:EnableDisableTextAndButtons();"
  686.               <% if( FALSE and FALSE = bUseProxyServer ) then %> disabled <% end if %> >
  687.             </td>
  688.             <td width=10> </td>
  689.             <td class="defaultcursor" nowrap>
  690.               <span nowrap ID="PortLabel"><%= Server.HTMLEncode( L_PORTCOLON_TEXT ) %> </span>
  691.             </td>
  692.             <td align=left>
  693.               <input 
  694.                 type="text" 
  695.                 name="port" 
  696.                 onKeyUp="JavaScript:EnableDisableTextAndButtons();" 
  697.                 onKeyDown="JavaScript:EnableDisableTextAndButtons();" 
  698.                 onChange="JavaScript:EnableDisableTextAndButtons();" 
  699.                 onPaste="JavaScript:EnableDisableTextAndButtons();" 
  700.                 value="<% if ( 0 < dwProxyPort ) then Response.Write( RemoveDangerousCharacters( dwProxyPort ) ) end if %>" 
  701.                 size=4 
  702.                 maxlength=5 
  703.                 tabindex=3
  704.               <% if( FALSE and FALSE = bUseProxyServer ) then %> disabled <% end if %> >
  705.             </td>
  706.             <td width=50%> </td>
  707.           </tr>
  708.         </table>
  709.       </td>
  710.     </tr>
  711.     <tr>
  712.       <td>
  713.         <table cellspacing=0 cellpadding=0 width="100%" border=0>
  714.         <tr>
  715.           <td width="10">
  716.              <br>
  717.           </td>
  718.           <td colspan=2>
  719.             <br>
  720.             <hr width="80%" align="left">
  721.             <br>
  722.             <table border=0 cellspacing=0 cellpadding=0 width="100%">
  723.             <tr>
  724.               <td>
  725.                 <div align="left" ID="CredHelp" class="helptext"><%= Server.HTMLEncode( L_NETSOURCEHELP1_TEXT ) %></div><br>
  726.                 <table cellspacing="0" cellpadding="0" border="1" width="90%"><tr><td>
  727.                 <table class="propgroupbox" width="1000%" border="0" cellpadding="0" cellspacing="0">
  728.                 <tr>
  729.                     <td width="10">
  730.                          
  731.                     </td>
  732.                     <td colspan="6">
  733.                     <input 
  734.                       type="checkbox" 
  735.                       name="ProxyRequiresAuthen" 
  736.                       ID="ProxyRequiresAuthenID"
  737.                       value="on" 
  738.                       tabindex=4 <% if( "" <> strUserName ) then %> checked <% end if %>
  739.                       onClick="JavaScript:EnableDisableTextAndButtons();"> 
  740.                       <label for="ProxyRequiresAuthenID" ID="ProxyRequiresAuthenLabel"
  741.                       class="defaultcursor">
  742.                     <% RenderWithErrorCheck Server.HTMLEncode( L_PROXYREQUIRESAUTHEN_TEXT ), "Credentials" %></label><br> 
  743.                             </td>
  744.                         </tr>
  745.                 <tr>
  746.                   <td width="10">
  747.                      
  748.                   </td>
  749.                 <td>
  750.                       <table class="propgroupbox" width="90%" border="0" cellpadding="0" cellspacing="0">
  751.                   <tr>
  752.                     <td width="10">
  753.                        
  754.                     </td>
  755.                     <td class="defaultcursor" colspan="6">
  756.                       <span ID="UsernameLabel"><%= Server.HTMLEncode( L_USERNAMECOLON_TEXT ) %></span>
  757.                     </td>
  758.                   </tr>
  759.                   <tr>
  760.                     <td width="10">
  761.                        
  762.                     </td>
  763.                     <td colspan="6"> 
  764.                       <input 
  765.                         type="text" 
  766.                         name="username" 
  767.                         value="<%= EscBackslashChar( Left( RemoveSpecifiedChars( SafeUnescape( trim( strUserName ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME ) ) %>" 
  768.                         tabindex="5"
  769.                         maxlength="500"
  770.                         onKeyDown="JavaScript:ValidateUserPass();"
  771.                         onKeyUp="JavaScript:ValidateUserPass();"
  772.                         onChange="JavaScript:ValidateUserPass();"
  773.                         onPaste="JavaScript:ValidateUserPass();"
  774.                       <%if ( FALSE = bUseProxyServer ) or ( FALSE = bServerRequiresAuthentication ) then %>disabled <% 
  775.                       end if %>
  776.                       ><br><br>
  777.                     </td>
  778.                   </tr>
  779.                   <tr>
  780.                     <td width="10">
  781.                        
  782.                     </td>
  783.                     <td class="defaultcursor" colspan="6">
  784.                       <span ID="PasswordLabel"><%= Server.HTMLEncode( L_PASSWORDCOLON_TEXT ) %></span>
  785.                     </td>
  786.                   </tr>
  787.                   <tr>
  788.                     <td width="10">
  789.                        
  790.                     </td>
  791.                     <td colspan=6> 
  792.                       <input 
  793.                         type="password" 
  794.                         name="password" 
  795.                         value="<%= Server.HTMLEncode( strPassword ) %>" 
  796.                         tabindex=6
  797.                         maxlength=254
  798.                         onKeyDown="JavaScript:ValidateUserPass();"
  799.                         onKeyUp="JavaScript:ValidateUserPass();"
  800.                         onChange="JavaScript:ValidateUserPass();"
  801.                         onPaste="JavaScript:ValidateUserPass();"
  802.                       <%if ( FALSE = bUseProxyServer ) or ( FALSE = bServerRequiresAuthentication ) then %>disabled <% 
  803.                       end if %>
  804.                       ><br><br>
  805.                     </td>
  806.                   </tr>
  807.                   <tr>
  808.                     <td width=10>
  809.                        
  810.                     </td>
  811.                     <td class="defaultcursor" colspan=6> 
  812.                       <span ID="ConfirmLabel"><%= Server.HTMLEncode( L_CONFIRMPASSCOLON_TEXT ) %></span>
  813.                     </td>
  814.                   </tr>
  815.                   <tr>
  816.                     <td width=10>
  817.                        
  818.                     </td>
  819.                     <td colspan=6> 
  820.                       <input 
  821.                         type="password" 
  822.                         name="confirm" 
  823.                         value="<%= Server.HTMLEncode( strPassword ) %>" 
  824.                         tabindex=7
  825.                         maxlength=254
  826.                         onKeyDown="JavaScript:ValidateUserPass();"
  827.                         onKeyUp="JavaScript:ValidateUserPass();"
  828.                         onChange="JavaScript:ValidateUserPass();"
  829.                         onPaste="JavaScript:ValidateUserPass();"
  830.                       <%if ( FALSE = bUseProxyServer ) or ( FALSE = bServerRequiresAuthentication ) then %>disabled <% 
  831.                       end if %>
  832.                       >
  833.                     </td>
  834.                   </tr>
  835.                 </table>
  836.                 </td></tr></table>
  837.               </td>
  838.             </tr>
  839.             </table>
  840.                 <br> 
  841.           </td>
  842.         </tr>
  843.         </table>
  844.       </td>
  845.     </tr>
  846.     </table>
  847.     </td>
  848.   </tr>
  849.   </table>
  850.   </td>
  851. </tr>
  852. <tr>
  853.   <td>
  854.     <tr>
  855.       <td valign="bottom">
  856.         <input id="ok" type="submit" align="baseline" name="ok" value="<%= Server.HTMLEncode( L_OKAYBUTTON_TEXT ) %>" tabIndex=8 > 
  857.         <input id="cancel" type="button" align="baseline" name="cancel" onclick="JavaScript:GoBack();" value="<%= Server.HTMLEncode( L_CANCELBUTTONSPACED_TEXT ) %>" tabIndex=9 > 
  858.         <input id="help" type="button" align="baseline" name="help" onclick="JavaScript:DoPluginHelp( '<%= H_NETSOURCEPROXYTOPIC %>' );" value="<%= Server.HTMLEncode( L_HELPBUTTONSPACED_TEXT ) %>" tabindex=10 >
  859.       </td>
  860.     </tr>
  861.   </td>
  862. </tr>
  863. </form>
  864. </table>
  865. <%
  866. AlertUserWithPopupErrorDialog
  867. OnErrorGoBack 
  868. DrawStdFooter
  869. %>
  870. </body>
  871. </html>
  872. <%
  873. LatchCurrentPage "plugins/NetSourceProxy.asp", qs
  874. EndErrorHandling "NetSourceProxy.asp" 
  875.  
  876. on error resume next
  877. PluginsASPCleanup
  878. %>